{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "c453c405",
   "metadata": {},
   "source": [
    "# 视频转文字项目运行指南\n",
    "\n",
    "## 1. 激活虚拟环境\n",
    "首先需要激活项目的虚拟环境。在命令行中执行以下命令："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ea7e8b42",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 激活虚拟环境\n",
    "import os\n",
    "os.system('cd D:\\work\\ai_video_txt && .\\venv\\Scripts\\activate')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "99a38be8",
   "metadata": {},
   "source": [
    "## 2. 安装依赖包\n",
    "确保所有依赖包都已安装："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f77988a0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: moviepy==1.0.3 in .\\venv\\lib\\site-packages (from -r requirements.txt (line 1)) (1.0.3)\n",
      "Requirement already satisfied: openai-whisper==20231117 in .\\venv\\lib\\site-packages (from -r requirements.txt (line 2)) (20231117)\n",
      "Requirement already satisfied: openai==1.12.0 in .\\venv\\lib\\site-packages (from -r requirements.txt (line 3)) (1.12.0)\n",
      "Requirement already satisfied: python-dotenv==1.0.0 in .\\venv\\lib\\site-packages (from -r requirements.txt (line 4)) (1.0.0)\n",
      "Requirement already satisfied: markdown==3.5.2 in .\\venv\\lib\\site-packages (from -r requirements.txt (line 5)) (3.5.2)\n",
      "Requirement already satisfied: requests==2.31.0 in .\\venv\\lib\\site-packages (from -r requirements.txt (line 6)) (2.31.0)\n",
      "Requirement already satisfied: tkinterdnd2==0.3.0 in .\\venv\\lib\\site-packages (from -r requirements.txt (line 7)) (0.3.0)\n",
      "Requirement already satisfied: decorator<5.0,>=4.0.2 in .\\venv\\lib\\site-packages (from moviepy==1.0.3->-r requirements.txt (line 1)) (4.4.2)\n",
      "Requirement already satisfied: imageio<3.0,>=2.5 in .\\venv\\lib\\site-packages (from moviepy==1.0.3->-r requirements.txt (line 1)) (2.37.0)\n",
      "Requirement already satisfied: imageio_ffmpeg>=0.2.0 in .\\venv\\lib\\site-packages (from moviepy==1.0.3->-r requirements.txt (line 1)) (0.6.0)\n",
      "Requirement already satisfied: tqdm<5.0,>=4.11.2 in .\\venv\\lib\\site-packages (from moviepy==1.0.3->-r requirements.txt (line 1)) (4.67.1)\n",
      "Requirement already satisfied: numpy>=1.17.3 in .\\venv\\lib\\site-packages (from moviepy==1.0.3->-r requirements.txt (line 1)) (2.1.3)\n",
      "Requirement already satisfied: proglog<=1.0.0 in .\\venv\\lib\\site-packages (from moviepy==1.0.3->-r requirements.txt (line 1)) (0.1.10)\n",
      "Requirement already satisfied: numba in .\\venv\\lib\\site-packages (from openai-whisper==20231117->-r requirements.txt (line 2)) (0.61.0)\n",
      "Requirement already satisfied: torch in .\\venv\\lib\\site-packages (from openai-whisper==20231117->-r requirements.txt (line 2)) (2.6.0)\n",
      "Requirement already satisfied: more-itertools in .\\venv\\lib\\site-packages (from openai-whisper==20231117->-r requirements.txt (line 2)) (10.6.0)\n",
      "Requirement already satisfied: tiktoken in .\\venv\\lib\\site-packages (from openai-whisper==20231117->-r requirements.txt (line 2)) (0.9.0)\n",
      "Requirement already satisfied: anyio<5,>=3.5.0 in .\\venv\\lib\\site-packages (from openai==1.12.0->-r requirements.txt (line 3)) (4.9.0)\n",
      "Requirement already satisfied: distro<2,>=1.7.0 in .\\venv\\lib\\site-packages (from openai==1.12.0->-r requirements.txt (line 3)) (1.9.0)\n",
      "Requirement already satisfied: httpx<1,>=0.23.0 in .\\venv\\lib\\site-packages (from openai==1.12.0->-r requirements.txt (line 3)) (0.28.1)\n",
      "Requirement already satisfied: pydantic<3,>=1.9.0 in .\\venv\\lib\\site-packages (from openai==1.12.0->-r requirements.txt (line 3)) (2.10.6)\n",
      "Requirement already satisfied: sniffio in .\\venv\\lib\\site-packages (from openai==1.12.0->-r requirements.txt (line 3)) (1.3.1)\n",
      "Requirement already satisfied: typing-extensions<5,>=4.7 in .\\venv\\lib\\site-packages (from openai==1.12.0->-r requirements.txt (line 3)) (4.12.2)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in .\\venv\\lib\\site-packages (from requests==2.31.0->-r requirements.txt (line 6)) (3.4.1)\n",
      "Requirement already satisfied: idna<4,>=2.5 in .\\venv\\lib\\site-packages (from requests==2.31.0->-r requirements.txt (line 6)) (3.10)\n",
      "Requirement already satisfied: urllib3<3,>=1.21.1 in .\\venv\\lib\\site-packages (from requests==2.31.0->-r requirements.txt (line 6)) (2.3.0)\n",
      "Requirement already satisfied: certifi>=2017.4.17 in .\\venv\\lib\\site-packages (from requests==2.31.0->-r requirements.txt (line 6)) (2025.1.31)\n",
      "Requirement already satisfied: exceptiongroup>=1.0.2 in .\\venv\\lib\\site-packages (from anyio<5,>=3.5.0->openai==1.12.0->-r requirements.txt (line 3)) (1.2.2)\n",
      "Requirement already satisfied: httpcore==1.* in .\\venv\\lib\\site-packages (from httpx<1,>=0.23.0->openai==1.12.0->-r requirements.txt (line 3)) (1.0.7)\n",
      "Requirement already satisfied: h11<0.15,>=0.13 in .\\venv\\lib\\site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai==1.12.0->-r requirements.txt (line 3)) (0.14.0)\n",
      "Requirement already satisfied: pillow>=8.3.2 in .\\venv\\lib\\site-packages (from imageio<3.0,>=2.5->moviepy==1.0.3->-r requirements.txt (line 1)) (11.1.0)\n",
      "Requirement already satisfied: annotated-types>=0.6.0 in .\\venv\\lib\\site-packages (from pydantic<3,>=1.9.0->openai==1.12.0->-r requirements.txt (line 3)) (0.7.0)\n",
      "Requirement already satisfied: pydantic-core==2.27.2 in .\\venv\\lib\\site-packages (from pydantic<3,>=1.9.0->openai==1.12.0->-r requirements.txt (line 3)) (2.27.2)\n",
      "Requirement already satisfied: colorama in .\\venv\\lib\\site-packages (from tqdm<5.0,>=4.11.2->moviepy==1.0.3->-r requirements.txt (line 1)) (0.4.6)\n",
      "Requirement already satisfied: llvmlite<0.45,>=0.44.0dev0 in .\\venv\\lib\\site-packages (from numba->openai-whisper==20231117->-r requirements.txt (line 2)) (0.44.0)\n",
      "Requirement already satisfied: regex>=2022.1.18 in .\\venv\\lib\\site-packages (from tiktoken->openai-whisper==20231117->-r requirements.txt (line 2)) (2024.11.6)\n",
      "Requirement already satisfied: filelock in .\\venv\\lib\\site-packages (from torch->openai-whisper==20231117->-r requirements.txt (line 2)) (3.18.0)\n",
      "Requirement already satisfied: networkx in .\\venv\\lib\\site-packages (from torch->openai-whisper==20231117->-r requirements.txt (line 2)) (3.4.2)\n",
      "Requirement already satisfied: jinja2 in .\\venv\\lib\\site-packages (from torch->openai-whisper==20231117->-r requirements.txt (line 2)) (3.1.6)\n",
      "Requirement already satisfied: fsspec in .\\venv\\lib\\site-packages (from torch->openai-whisper==20231117->-r requirements.txt (line 2)) (2025.3.0)\n",
      "Requirement already satisfied: sympy==1.13.1 in .\\venv\\lib\\site-packages (from torch->openai-whisper==20231117->-r requirements.txt (line 2)) (1.13.1)\n",
      "Requirement already satisfied: mpmath<1.4,>=1.1.0 in .\\venv\\lib\\site-packages (from sympy==1.13.1->torch->openai-whisper==20231117->-r requirements.txt (line 2)) (1.3.0)\n",
      "Requirement already satisfied: MarkupSafe>=2.0 in .\\venv\\lib\\site-packages (from jinja2->torch->openai-whisper==20231117->-r requirements.txt (line 2)) (3.0.2)\n"
     ]
    }
   ],
   "source": [
    "# 安装依赖包\n",
    "!pip install -r requirements.txt"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2cd0341a",
   "metadata": {},
   "source": [
    "## 3. 运行程序\n",
    "运行主程序："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "35f989fb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "ename": "",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31mThe Kernel crashed while executing code in the current cell or a previous cell. \n",
      "\u001b[1;31mPlease review the code in the cell(s) to identify a possible cause of the failure. \n",
      "\u001b[1;31mClick <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info. \n",
      "\u001b[1;31mView Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details."
     ]
    }
   ],
   "source": [
    "# 运行主程序\n",
    "import os\n",
    "os.system('python main.py')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bf38ad11",
   "metadata": {},
   "source": [
    "## 4. 使用说明\n",
    "- 程序启动后会打开GUI界面\n",
    "- 选择要处理的视频文件\n",
    "- 等待处理完成，结果将保存为markdown文件\n",
    "\n",
    "## 5. 注意事项\n",
    "- 确保视频文件格式受支持\n",
    "- 处理大文件时可能需要较长时间\n",
    "- 确保有足够的磁盘空间\n",
    "- 如果遇到问题，请检查控制台输出的错误信息"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
